import Router from '../vue-router';
import Vue from 'vue';

import Home from '../views/home.vue'
import About from '../views/about.vue'

//use方法会调用install方法  会注册全局组件 router-link router-view
Vue.use(Router);

//创建映射表
let routes = [
    {
        path: '/',
        component: Home
    },
    {
        path: '/about',
        component: About,
        children: [
            {
                path: 'a',
                component: {
                    render(h) {
                        return <h1>about/a</h1> //内部还是会转换为h('h1',['about/a'])
                    },
                }
            },
            {
                path: 'b',
                component: {
                    render: h => <h1>about b</h1>
                }
            },

        ]
    }
]

export default new Router({
    routes
})